#version 450 core

layout (location = 0) out vec4 o_Color;
//out int o_EntityID;

struct VertexOutput
{
	vec4 Color;
	vec2 TexCoord;
	float TilingFactor;
};

layout (location = 0) in VertexOutput Output;
layout (location = 3) in float v_TexIndex;
layout (location = 4) in flat int v_EntityID;

layout (location = 0) uniform float Select;
layout (location = 1) uniform vec4 SelectColor;
uniform sampler2D u_Textures[1];

void main()
{
	if(Select > 0.0){
		o_Color = SelectColor;
	}
	else{
		vec4 texColor = Output.Color;

		switch(int(v_TexIndex))
		{
			case  0: texColor *= vec4(1.0, 1.0, 1.0, texture(u_Textures[0], Output.TexCoord).r); break;
		}
		if (texColor.a == 0.0)
			discard;

		o_Color = texColor;
	}
	//o_EntityID = v_EntityID;
	
}
